package com.bnzj.cloud.business.core.service;

import com.bnzj.cloud.business.core.persistence.entity.SysJobLog;
import com.bnzj.cloud.business.core.persistence.repository.SysJobLogRepository;
import com.bnzj.core.persistence.BaseService;
import com.bnzj.core.persistence.query.QueryHelpBean;
import com.bnzj.core.quartz.log.JobLog;
import com.bnzj.core.quartz.log.JobLogService;
import org.springframework.stereotype.Service;

@Service
public class SysJobLogService extends BaseService<SysJobLogRepository, SysJobLog, Long> implements JobLogService {

    @Override
    public void add(JobLog jobLog) {
        if (jobLog instanceof SysJobLog) {
            this.save((SysJobLog) jobLog);
        }
    }

    @Override
    public JobLog createJobLog() {
        return new SysJobLog();
    }


    public static QueryHelpBean getQueryHelpBean() {
        String selectSQL = "SELECT log.* ";
        String whereSQL = " FROM bnz_sys_job_log log where 1=1  ";
        QueryHelpBean queryBean = new QueryHelpBean(selectSQL + whereSQL, "select count(1)" + whereSQL, SysJobLog.class);
        return queryBean;
    }
}
